#!/bin/bash

source /opt/mv-bash/helper-func.sh
auto_trap_all_errors


root=$(cd "$(dirname "$0")";pwd)
ARG_TODAY=$1
ARG_ENV=$2
ARG_DB=$3
ARG_TABLE=$4


export user=`id -un`
case $ARG_ENV in
 dev)
        PYTHON_VENV_PATH="/home/${user}/python-venvs-2.7/warehouse_quality_venv"
        ;;
 prod)
        PYTHON_VENV_PATH="/opt/python-venvs-2.7/warehouse_quality_venv"
        ;;
 *)
        ;;
esac


#进入 venv
source ${PYTHON_VENV_PATH}/bin/activate

python ${root}/../dataquality/monitor/monitor.py -d ${ARG_TODAY} -e ${ARG_ENV} -b ${ARG_DB} -t ${ARG_TABLE}

#退出venv
deactivate
